package com.luyuan.crm.promotion.web;

import javax.faces.event.ActionEvent;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.ruijie.foundation.query.criteria.CriteriaTemplate;
import com.ruijie.web.jsf.action.BaseAction;

@Component("holidaySalesAction")
@Scope("view")
public class HolidaySalesAction extends BaseAction implements InitializingBean {
    private CriteriaTemplate criteriaTemplate;

    /**
     * 节假日短信内容
     */
    private String sms;

    /**
     * 积分赠送原因
     */
    private String remark;

    /**
     * 赠送积分
     */
    private int integral;

    public void bestowIntegral(ActionEvent event) {
        setRequestAttribute("member.criteriaTemplate", criteriaTemplate, true);
        setRequestAttribute("holidaySales.sms", sms, true);
        setRequestAttribute("holidaySales.remark", remark, true);
        setRequestAttribute("holidaySales.integral", integral, true);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        criteriaTemplate = (CriteriaTemplate) getRequestAttribute("member.criteriaTemplate");
    }

    public CriteriaTemplate getCriteriaTemplate() {
        return criteriaTemplate;
    }

    public void setCriteriaTemplate(CriteriaTemplate criteriaTemplate) {
        this.criteriaTemplate = criteriaTemplate;
    }

    public String getSms() {
        return sms;
    }

    public void setSms(String sms) {
        this.sms = sms;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getIntegral() {
        return integral;
    }

    public void setIntegral(int integral) {
        this.integral = integral;
    }
}
